<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="/template.xhtml">
	<ui:define name="tituloPagina">
		<p:outputLabel value="#{msgs['paginas.consulta.responsaveis']}" />
	</ui:define>
	
	<ui:define name="botoes">
		<p:commandButton action="#{pessoaBean.novo}" value="Novo"  styleClass="botaoNovo" />
		
	</ui:define>
	
	
	
	
	<ui:define name="principal">
		<p:panelGrid columns="3"   style="margin-left:641px; margin-top: -18px;">
			<p:outputLabel value="Nome"/>
			
		<p:autoComplete value="#{pessoaBean.nomeResponsavelSelecionado}"
				completeMethod="#{pessoaBean.complete}" queryDelay="700"></p:autoComplete>
			
			<p:commandButton icon="ui-icon-search" action="#{pessoaBean.listarByFiltros}" 
			title="Pesquisar" ajax="false"></p:commandButton>
		</p:panelGrid>
		<br />
		<p:dataTable value="#{pessoaBean.listaResponsavel}" var="_lista"
			paginator="true" rows="10" widgetVar="dataTable">
			<p:column headerText="Nome">
				<p:outputLabel value="#{_lista.nome}" />
			</p:column>

			<p:column headerText="Matricula">
				<p:outputLabel value="#{_lista.matricula}" />
			</p:column>

			<p:column headerText="Email">
				<p:outputLabel value="#{_lista.email}" />
			</p:column>
			<p:column headerText="Gerencia">
							<p:outputLabel value="#{_lista.gerencia.nome}" />
			
			</p:column>

			<p:column headerText="Ações">
				<p:commandButton icon="ui-icon-pencil" title="Editar Responsável" action="#{pessoaBean.editar}">
					<f:setPropertyActionListener target="#{pessoaBean.pessoa}"
						value="#{_lista}" />

				</p:commandButton>
				<p:commandButton icon="ui-icon-close" title="Excluir Responsável"
					action="#{pessoaBean.excluir()}" ajax="false">
					<f:setPropertyActionListener target="#{pessoaBean.pessoa}"
						value="#{_lista}" />

				</p:commandButton>
			</p:column>
		</p:dataTable>
	</ui:define>
</ui:composition>
</html>